with open('population.txt') as men:
    number=0
    numbers=0
    name={}
    for line in men:
        line=list(line.split())
        line[-1]=line[-1].replace(',','')
        name_=' '.join(a for a in line[:-1])
        name[name_]=str(line[-1])
        numbers=numbers+1
    list1=list(name.keys())
    list1.sort()
    for i in list1:
        number=number+int(name[i])
        print(i,name[i])
    print('SUM:'+str(number))
    print('AVE:'+f'{number/numbers:.2f}')
    
        
